#!/usr/bin/env python

import socket
import sys
import time

HOST = '192.168.0.29'
PORT = 6600
RECV_SIZE = 2**20 # One megabyte
try:
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  print 'Connecting to %s:%d...' % (HOST, PORT)
  s.connect((HOST, PORT))
except socket.error:
  print 'Unable to connect.'
  sys.exit(1)

print s.recv(RECV_SIZE)

cmd = 'clear'
s.send(cmd + '\n')

print s.recv(RECV_SIZE)

cmd = 'add http://live.zeilsteen.com'
s.send(cmd + '\n')

print s.recv(RECV_SIZE)

cmd = 'play'
s.send(cmd + '\n')

print s.recv(RECV_SIZE)

time.sleep(15)

cmd = 'clear'
s.send(cmd + '\n')

print s.recv(RECV_SIZE)

s.close()

